package com.lcm.learn.lcmcode.collection;

import java.io.*;
import java.util.LinkedList;

/**
 * @description:
 * @author: lcm
 * @create: 2019-12-13 11:52
 **/

public class LinkedListTest {

    public static void main(String[] args) throws IOException, ClassNotFoundException {
        LinkedList list=new LinkedList();
        list.add(1);
        ByteArrayOutputStream bout = new ByteArrayOutputStream();
        ObjectOutputStream out = new ObjectOutputStream(bout);
        out.writeObject(list);
        out.close();

        ObjectInputStream in = new ObjectInputStream(
                new ByteArrayInputStream(bout.toByteArray()));
        LinkedList list1=(LinkedList)in.readObject();

        System.out.println(list1);
    }
}
